package com.sbdemo;

import com.sbdemo.bean.TestBean;
import com.sbdemo.service.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/3/7.
 */
@SpringBootApplication
@RestController
public class Main {

    @Autowired
    private ITestService testService;

    @RequestMapping(value = {"/","/index"})
    public String index(){
        TestBean t = testService.findOne(1L);
        if (t == null){
            boolean result = testService.addTestBean(new TestBean("test","test"));
            if (!result){
                //初始化诗句失败记录
            }
        }
        return "welcome to my sys!";
    }

    public static void main(String[] args) {
        SpringApplication.run(Main.class);
    }
}
